import yagmail,logging,yaml

# 封装日志
def log_set():
    logging.basicConfig(filename='xuexoqiangguo.txt',level=logging.DEBUG,filemode='w+',
                        format=' %(asctime)s -> %(levelname)s -> %(message)s ')

# 发送报告
def send_mail(file):
    mail=yagmail.SMTP(user='2440154941@qq.com',password='sgeliorajsvseaba',host='smtp.qq.com')
    mail.send(to='2440154941@qq.com',subject='学习强国自动化测试报告',contents='学习强国',attachments=file)


# 数据驱动
def get_data_from_yaml(files):
    with open(files,encoding='utf-8') as f:
        return yaml.safe_load(f)